/**
 * author:Administrator
 * date:2016/2/24
 * desc:TODO
 */
'use strict';


let seq = 1;
let list = {};

class WareRepoImpl {


  static * genId() {
    return 'ware_' + (seq++);
  }

  static * find(id) {
    return list[id];
  }

  static *store(ware) {
    if (!ware.id) ware.id = yield WareRepoImpl.genId();
    list[ware.id] = ware;
  }

  static * decrease(id, count, t) {
    let item = list[id];
    item.remain -= count;
    return true;
  }
}
module.exports = WareRepoImpl;